package cn.diancan.mobile.security;

import org.apache.struts2.ServletActionContext;

/**
 * 
 * @author Sky
 *
 */
public class MemberMobileApiAuthUtil {
    
    private static String USERID    = "userId";
    private static String SESSIONID = "sessionId";
    public static String ISCHECKLOGIN ="isCheckLogin";
    public static String MEMBERLOGINSTATUS ="memberLoginStatus";//登录状态，才能赋值进去
    
    
    public static Long getUserId() throws Exception{
	String userId=  ServletActionContext.getRequest().getParameter(USERID);
	if(null==userId){
	    return null;
	}
	return Long.valueOf(userId);
    }
    
    public static String getSessionId(){
	return ServletActionContext.getRequest().getParameter(SESSIONID);
    }
    
    /**
     * 登录状态
     * @return
     */
    public static Boolean getMemberLoginStatus(){
	Object memberLoginStatus =ServletActionContext.getRequest().getAttribute(MEMBERLOGINSTATUS);
	if(null == memberLoginStatus){
	    return false;
	} 
	return true;
    }
   
}
